Feature/historical price tracking#27
Merged
JerryIdoko merged 2 commits intoVesting-Vault:mainfrom Feb 20, 2026
Merged
Conversation
added 2 commits
February 20, 2026 03:33
- Add price_at_claim_usd column to claims_history table - Implement CoinGecko price fetching service with caching - Create indexing service for automatic price population during claim processing - Add API endpoints for claim processing and realized gains calculation - Include comprehensive test suite and documentation - Support batch processing and price backfilling - Enable tax compliance through accurate USD value tracking Resolves: Issue 15 - [DB] Historical Price Tracking
- Comprehensive instructions for running backend locally - Database setup and configuration steps - API testing examples - Troubleshooting guide - Production deployment considerations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚀 Feature: Historical Price Tracking for Realized Gains Calculation
📋 Summary
Implements comprehensive historical price tracking to enable accurate "Realized Gains" calculations for tax reporting. This feature automatically fetches and stores token prices at the moment of each claim, providing the necessary data for compliance and financial reporting.
🎯 Acceptance Criteria Met
✅ Table claims_history add column price_at_claim_usd - Added DECIMAL(36,18) column with proper indexing
✅ Fetch price from Coingecko during indexing - Automatic price fetching with caching and error handling
🔧 Key Features
Database Schema: Added price_at_claim_usd column to claims_history table
Price Service: CoinGecko integration with smart caching and rate limit handling
Indexing Service: Automatic price population during claim processing
API Endpoints: 4 new endpoints for claims processing and realized gains calculation
Tax Compliance: Precise USD value tracking for accurate financial reporting
📊 API Endpoints Added
POST /api/claims - Process single claim with automatic price fetching
POST /api/claims/batch - Process multiple claims efficiently
POST /api/claims/backfill-prices - Backfill missing prices for existing claims
GET /api/claims/:userAddress/realized-gains - Calculate realized gains for tax reporting
🧪 Testing
Comprehensive test suite covering all functionality
Manual testing commands provided
Local development setup guide included
📚 Documentation
Complete feature documentation (HISTORICAL_PRICE_TRACKING.md)
Local development setup guide (RUN_LOCALLY.md)
Inline code comments throughout
closes #15